Function.RegisterNamespace("Test");

[Import("../../Source/Extensions.js/Boolean.js")]
[Fixture]
Test.Boolean=function(){
    [Fixture]
    function Equals(){
        [Fact]
        function ThrowsIfPassedInvalidExpectedBoolean(){
            var expected="Boolean.Equals: 'expected' must be a valid Boolean.";
        
            var actual=Record.Exception(function(){
                Boolean.Equals(new Object());
            });
            
            Assert.Equal(expected,actual);
        }
        
        [Fact]
        function CoercesActualToBoolean(){
            var actual=Boolean.Equals(true,new Object());
            
            Assert.True(actual);
        }
        
        [Fact]
        function ReturnsTrueIfTrueBooleansMatch(){
            var actual=Boolean.Equals(true,true);
        
            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseIfBooleansDontMatch(){
            var actual=Boolean.Equals(true,false);
        
            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueIfFalseBooleansMatch(){
            var actual=Boolean.Equals(false,false);
        
            Assert.True(actual);
        }
        
        [Fact]
        function SetsValueOnReasonIfPassed(){
            var expected="Boolean.Equals: Booleans did not match. Expected 'true', found 'false'.";
            var reason={};
            
            Boolean.Equals(true,false,reason);
            var actual=reason.Value;
            
            Assert.Equal(expected,actual);
        }        
    }
}